Skip to content

avm2: Add SecureSocket support#23237

Open
Xeleron wants to merge 1 commit intoruffle-rs:masterfrom
Xeleron:securesocket
Open

avm2: Add SecureSocket support#23237
Xeleron wants to merge 1 commit intoruffle-rs:masterfrom
Xeleron:securesocket

Conversation

@Xeleron
Copy link
Contributor

@Xeleron Xeleron commented Mar 12, 2026

This PR implements the flash.net.SecureSocket class for AVM2, enabling support for encrypted socket communication within Ruffle. The contents of this pull request were substantially written using Claude Opus 4.6. I've reviewed to the best of my ability.

Changes

AVM2 (core)

  • Added flash.net.SecureSocket ActionScript class definition (SecureSocket.as).
  • Implemented native Rust bindings and state management for secure sockets.
  • Updated SocketObject and Sockets manager to support TLS handshake and certificate tracking.

Backends (core, frontend-utils)

  • Extended NavigatorBackend with connect_secure functionality.
  • Integrated rustls into frontend-utils to provide cross-platform TLS support (web and desktop).

Testing (tests)

  • Updated the mocket test utility to support TLS server simulation.
  • Added a new regression test avm2/secure_socket_connect to verify the end-to-end secure connection flow, including handshake and data exchange.

@danielhjacobs danielhjacobs added llm The PR contains mostly LLM-generated code A-avm2 Area: AVM2 (ActionScript 3) T-compat Type: Compatibility with Flash Player labels Mar 12, 2026
Implement SecureSocket AS3 class and runtime support: add SecureSocket AS file and native bindings, integrate TLS certificate status into SocketObject and Sockets manager, add NavigatorBackend secure connect path and frontend-utils TLS support, update Cargo manifests, and add tests + fixtures for secure socket behavior.

Co-authored-by: Claude <claude@anthropic.com>
@Lord-McSweeney
Copy link
Collaborator

Have you found any content that depends on this? IMO we probably shouldn't be adding such a large amount of code to support something if nothing uses it.

@Xeleron
Copy link
Contributor Author

Xeleron commented Mar 15, 2026

Have you found any content that depends on this? IMO we probably shouldn't be adding such a large amount of code to support something if nothing uses it.

I was planning to use it perhaps for AQWorlds instead of depending on https://github.com/timkurvers/as3-crypto (AS3Crypto from Hurlant, their TLSEngine/TLSSocket classes in particular) in addition with WebSockets.
Other than that, I am not aware of any other SWF content depending on SecureSocket.
It worked fine for me locally with a custom client build and with this Ruffle branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-avm2 Area: AVM2 (ActionScript 3) llm The PR contains mostly LLM-generated code T-compat Type: Compatibility with Flash Player

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants